﻿using System;
using Loki.Commands;
using Loki.IoC;
using Loki.Utils;

namespace Loki.UI
{
    public class DisplayElement : TrackedObject, IContextAware
    {
        public IMessageComponent CommonBus
        {
            get;
            set;
        }

        public IObjectCreator Context
        {
            protected get;
            set;
        }

        public ICommandComponent CommandService
        {
            get;
            set;
        }

        public IEventComponent EventService
        {
            get;
            set;
        }

        public CommandManager Commands
        {
            get;
            set;
        }

        #region ContextInitialized

        public event EventHandler ContextInitialized;

        protected virtual void OnContextInitialized(EventArgs e)
        {
            EventHandler handler = ContextInitialized;

            if (handler != null)
            {
                handler(this, e);
            }
        }

        #endregion ContextInitialized
    }
}